package com.lzz.bottomencapsulation.adapter;

import android.view.View;
import android.view.ViewGroup;

import androidx.viewpager.widget.PagerAdapter;

import java.util.List;

/***
 @package ${package}
 @filename ${filename}
 */
public class ViewPagerAdapter2 extends PagerAdapter {
    List<String> strings;
    private List<View> viewList;
    public ViewPagerAdapter2(List<String> strings, List<View> views) {
        this.strings=strings;
        this.viewList=views;
    }

    @Override
    public void destroyItem(ViewGroup container, int position, Object object) {
        container.removeView((View)object);
    }

    @Override
    public int getCount() {
        return viewList.size();
    }

    @Override
    public Object instantiateItem(ViewGroup container, int position) {
        container.addView(viewList.get(position));
        return viewList.get(position);
    }

    @Override
    public boolean isViewFromObject(View view, Object object) {
        return view == object;
    }

    @Override
    public int getItemPosition(Object object) {
        return POSITION_NONE;
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return strings.get(position);
    }
}

